/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-12-10     xu       the first version
 */
#ifndef APPLICATIONS_KEY_TASK_H_
#define APPLICATIONS_KEY_TASK_H_

#include <rtthread.h>

struct key_task {
    const char* name;
    rt_bool_t running;
    rt_uint32_t scan_ms;
    rt_mq_t mq;
    rt_sem_t sem;
    rt_thread_t thread;
};

typedef struct key_task* key_task_t;

key_task_t key_task_create(rt_mq_t mq, rt_uint32_t scan_ms);

rt_bool_t key_task_start(key_task_t context);

rt_bool_t key_task_stop(key_task_t context);

rt_bool_t key_task_destroy(key_task_t context);

#endif /* APPLICATIONS_KEY_TASK_H_ */
